<style type="text/css">
    .forget_title{
        margin-left: 18px;
    }
    .forget_title h2 {
        display: block;
        height: 32px;
        line-height: 30px;
        margin: 0;
    }
    .forget_main{
        margin-left: 18px;
    }
    .colleft {
        float: left;
        margin: 5px 10px 0 0;
        padding: 7px 0;
        text-align: right;
        width: 100px;
    }
    .colright {
        float: left;
        margin: 5px 0;
        padding: 4px 0;
        width: 345px;
    }
    .forget_main .submit{
        background-color: #A67946;
        border: medium none;
        color: #FFFFFF;
        cursor: pointer;
        float: none;
        font-size: 14px;
        height: 25px;
        margin: 0 5px;
        padding: 0 0 5px;
        width: 80px;
    }
    .forget_info{
        color: #5C330E;
        margin: 20px;
    }
    .rq_red {
        color: red;
        height: 33px;
        vertical-align: top;
    }
    .forget_success_title{
        text-transform: uppercase;
        margin:20px 0 20px 0px;
    }
</style>
<div>
    <div class="forget_title"><h2 class="background_title"><a href="" title=""><span><?php echo lang('reg.restore_password');?></span></a></h2></div>
    <div class="forget_main">
        <?php if($show_success){ ?>
            <div class="height-10 clear">&nbsp;</div>
            <div class="forget_success_title">
                <H2><?php echo lang('reg.send_successful');?></H2>
            </div>
            <div class="height-15 clear">&nbsp;</div>
            <div class="forget_notice"> <?php echo lang('reg.pass_word_send_to')?>: <?php echo $lb_email;?>.<br/>
                <?php echo lang('reg.not_get_email_contact')?>: <a href="mailto:<?php echo $this->config->item('contact_email')?>"><?php echo $this->config->item('contact_email')?></a> </div>
        <?php }else{ ?>
            <div class="height-10 clear">&nbsp;</div>
            <div class="height-15 clear">&nbsp;</div>
            <div class="forget_frm">
                <div class="forget_frm_sub">
                    <div class="forget_info"><?php echo lang('reg.guide')?></div>
                    <form method="post" action="" name="frm_forget" id="frm_forget">
                        <?php if($err==1){?>
                        <div class="colleft"></div>
                        <div class="colright err"><?php echo $err_mess;?></div>
                        <div class="clear"></div>
                        <?php }?>
                        <div class="colleft"><?php echo lang('reg.email');?><span class="required">*</span></div>
                        <div class="colright">
                            <input type="text" value="" name="lb_email" id="lb_email" class="w300">
                             </div>
                        <div class="clear"></div>
                        <div class="colleft"></div>
                        <div class="colright"> <span id="captcha" style="vertical-align:bottom"> <img   width="110" height="44" id="siimage" src="<?php echo base_url()."capchaimage/securimage/".rand(0,100); ?>"  align="absmiddle"/> </span> <span style="vertical-align:bottom"> <img src="<?php echo base_url()?>templates/images/refresh.png" style="border:none;" onclick="document.getElementById('siimage').src ='<?php echo base_url()."capchaimage/securimage/"; ?>'+Math.random(); return false" /> </span> </div>
                        <div class="clear"></div>
                        <div class="colleft"><?php echo lang('reg.captcha');?><span class="required">*</span></div>
                        <div class="colright" style="vertical-align:bottom">
                            <input type="text" value="" name="code" id="code" class="w150">
                        </div>
                        <div class="clear"></div>
                        <div class="colleft">&nbsp;</div>
                        <div class="colright">
                            <input type="submit" value="<?php echo lang('reg.send')?>" name="bt_send" id="bt_send" class="submit">
                            <input type="hidden"  id="act" name="act" value="send">
                            <input type="hidden" name="type" value="ajax"/>
                            <input onclick="$('#frm_forget').validate().resetForm();" type="reset" value="<?php echo lang('reg.reset')?>" name="bt_reset" class="submit">
                        </div>
                    </form>
                </div>
            </div>
        <?php } ?>
        <div class="clear">&nbsp;</div>
    </div>
</div>
<script type="text/javascript" >
	//co hieu biet de save roi.
	var flag_save =true;
	$(document).ready(function(){
		$("#bt_send").click(function(){
			$("#frm_forget").validate({
				rules: {
					lb_email:{required:true},
					code : {required:true}
				},
				messages: {
					lb_email: { required: Msg['rg.enter_email']},
					code: { required: Msg['rg.enter_captcha'] }
				},
				submitHandler: function(form) 
				{
					dataString = $("#frm_forget").serialize();
					if(flag_save==true)
					{
						flag_save = false;
						//$("#iconload").css('display','block');
						$.ajax({
							type: "POST",
							url: base_url+anw.lang+"/member/forget_pass",
							data: dataString,
							dataType: 'html',
							async:true,
							success: function(data) {
								//$("#iconload").css('display','none');
								flag_save = true;
                                $(".container").html(data);
							}
						});
					}
        		}
			});

		});
	});
</script> 
